package com.fatan.demo

import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.padding
import androidx.compose.material3.Button
import androidx.compose.material3.Surface
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import androidx.lifecycle.viewmodel.compose.viewModel

@Composable
@Preview
fun DemoCompose(
    demoViewModel: DemoViewModel = viewModel()
) {
    Surface(modifier = Modifier.fillMaxSize()) {
        Column(Modifier.padding(12.dp)) {
            Button(
                onClick = { demoViewModel.create() },
                modifier = Modifier.fillMaxWidth()
            ) {
                Text(text = "Create")
            }
            Button(
                onClick = { demoViewModel.start() },
                modifier = Modifier.fillMaxWidth()
            ) {
                Text(text = "Start")
            }
        }
    }
}